package com.cooge.jiexi;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;

public class Streamocean {
	
	public static void main(String[] args) throws IOException {
		File file = new File("aaa.txt");
		FileOutputStream  fos = new FileOutputStream(file);
		OutputStreamWriter opw= new OutputStreamWriter(fos,"utf-8");
		PrintWriter pw = new PrintWriter(opw, true);
		for(int i=23279;i<100000;i++){
			
			System.out.println(i);
			
			String url = "http://www.streamocean.com/puteasy/index.php/Home1/Index/play/id/"+i+"/";
			
			try {
				String content = NetUtil.getHtml(url);
				int start = content.indexOf("playvideo")+"playvideo".length();
				content =  content.substring(start);
				start = content.indexOf("playVideoByUrl");
				content = content.substring(0, start);
				
				start = content.indexOf("var url = '")+"var url = '".length();
				content =  content.substring(start);
				start = content.indexOf("'");
				content = content.substring(0, start);
				
				if(content.length()>0){
					System.out.println(i+":"+content);
					if(content.contains("live")){
						System.out.println("-------------------------------------------------");
							pw.println(i+":"+content);
					}
				}
				
			} catch (Exception e) {
				// TODO Auto-generated catch block

				e.printStackTrace();
			}
		}
		pw.flush();
		pw.close();
		

	}


}
